<?php
/**
 * @file user.php $
 * @author LiangJian (liangjian@haibao.com) $
 * @date 2015年7月22日 下午12:09:25 $
 * @brief  $
 */
namespace haibao\app\data;

class SnsWeiboBind extends \haibao\app\data\BaseMysql{

	public function __construct(){
		parent::__construct('\haibao\app\model\data\snsweibobind');
		$this->setConfig( \haibao\classlibrary\app\Config::CLASSLIBRARY_CONFIG_MYSQL_HAIBAO_DZ3 );
	}
	
	public function getBindByQQ($qquid){
		$this->setReadPerformance(true);
		$sql = "select * from sns_weibobind where qquid=%s and new_remove=0 limit 1";
		$result = $this->query($sql, array($qquid));
		return $result->fetch_assoc();
	}
	
	public function getBindByWB($wbuid){
		$sql = "select * from sns_weibobind where wbuid=%s limit 1";
		$result = $this->query($sql, array($wbuid));
		return $result->fetch_assoc();
	}
	
	public function getBindByWX($uId){
		$sql = "select * from sns_weibobind where wxuid=%s limit 1";
		$result = $this->query($sql, array($uId));
		return $result->fetch_assoc();
	}
	
	public function getBindByUserId($userId){
		$sql = "select * from sns_weibobind where user_id=%s limit 1";
		$result = $this->query($sql, array($userId));
		return $result->fetch_assoc();
	}
	
	public function addBind($model){
		$this->add($model);
	}

}